import unittest
import rect

class MyTestCase(unittest.TestCase):
    def test_something(self):
        r1 = rect.Rect(1234, 2.33)
        self.assertEqual(1234, r1.length)
        self.assertAlmostEqual(2.33, r1.width)
        self.assertAlmostEqual(1236.33, r1.half_perimeter)
        self.assertAlmostEqual(2472.66, r1.perimeter())
        self.assertAlmostEqual(2472.66, r1.perimeter(print_result=False))
        self.assertAlmostEqual(2472.66, r1.perimeter(print_result=True))
        self.assertAlmostEqual(2875.22, r1.area())
        self.assertAlmostEqual(2875.22, r1.area(print_result=False))
        self.assertAlmostEqual(2875.22, r1.area(print_result=True))
        r2 = rect.Rect(5678, 3.22)
        self.assertEqual(r1.area(print_result=False) + r2.area(print_result=False), r1.Sum(r2))
        self.assertEqual(r1.Sum(r2), r2.Sum(r1))


if __name__ == '__main__':
    unittest.main()
